<template>
	<view v-bind:style="{height:phoneHeight+'px'}" style="position:relative;">
		<view class="projectSchedule" v-if="isShow">
			<steps-box activeColor="#8273F5" deactiveColor="#CCCCCC" :active="statusNum" @SignContract="loadData" :option="option">
			</steps-box>
		</view>
	</view>
</template>

<script>
	import stepsBox from './components/stepsBox.vue'
	import {
		getMemberInfo
	} from '@/api/directSelling.js';
	import {
		shop_ht,
	} from '@/config/app_member.js';
	export default {
		components: {
			stepsBox
		},
		data() {
			return {
				statusNum: 6,
				phoneHeight: 0,
				isShow:false,
				option: [{
					title: "创建通联会员",
					status: 1,
					statusName: "已创建",
				}, {
					title: "实名认证",
					status: 1,
					statusName: "已认证",
				}, {
					title: "绑定手机号",
					status: 1,
					statusName: "已绑定",
				}, {
					title: "绑定银行卡",
					status: 1,
					statusName: "已绑定",
				}, {
					title: "电子签约",
					status: 1,
					statusName: "已签约",
				}, {
					title: "提现",
					status: 0,
					statusName: "",
				}]
			}
		},
		onReady() {
			console.log("onReady");
			// 计算屏幕剩余高度  填补剩余高度
			let _this = this;
			uni.getSystemInfo({
				success(res) {
					_this.phoneHeight = res.windowHeight;
				}
			});
		},
		onShow() {
			this.isShow=false;
			this.loadData();
		},
		methods:{
			loadData(){
				getMemberInfo().then(res=>{
					let data=res.data;
					uni.setStorageSync('userInfo', data);
					uni.request({
						url: shop_ht+'/shop_ht/manage/getMemberInfoForTl.do?memberCode='+data.memberCode,
						method: "get",
						success: (res) => {
							let statusData=res.data;
							console.log(statusData);
							this.option[0].status=statusData.isTlMember?1:0;//创建通联会员
							this.option[0].statusName=statusData.isTlMember?'已创建':"未创建";
							this.option[1].status=statusData.isIdentityChecked?1:0;//实名认证
							this.option[1].statusName=statusData.isIdentityChecked?'已实名':"未实名";
							this.option[2].status=statusData.isPhoneChecked?1:0;//绑定手机号
							this.option[2].statusName=statusData.isPhoneChecked?'已绑定':"未绑定";
							this.option[3].status=statusData.isBandCard?1:0;//绑定银行卡
							this.option[3].statusName=statusData.isBandCard?'已绑定':"未绑定";
							this.option[4].status=statusData.isSignContract?1:0;//绑定银行卡
							this.option[4].statusName=statusData.isSignContract?'已签约':"未签约";
							
							if(this.option[0].status==1 && this.option[1].status==1 &&this.option[2].status==1 &&this.option[3].status==1 &&this.option[4].status==1){
								this.option[5].status=1;//绑定银行卡
								this.option[5].statusName="可提现";
							}else{
								this.option[5].status=0;//绑定银行卡
								this.option[5].statusName="请完善流程";
							}
							
							
							setTimeout(()=>{
								this.isShow=true;
							},2000)
						}
					})
				})
				
			}
		}
	}		
</script>

<style lang="scss" >
	.projectSchedule {
		padding: 96rpx 75rpx 40rpx 75rpx;
		box-sizing: border-box;
		height: 100%;
		background: #fff;
		border-radius: 30rpx 30rpx 0 0;
		box-shadow: 0px 0px 8px 1px rgba(0, 0, 0, 0.1);
		border: solid 1px #F3F3F3;
	}
</style>
